package com.api.shopapi.service.impl;


import com.api.shopapi.entity.ReceiveMessage;
import com.api.shopapi.mapper.ReceiveMessageMapper;
import com.api.shopapi.service.ReceiveMessageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ReceiveMessageServiceImplOne")
public class ReceiveMessageServiceImpl implements ReceiveMessageService {

    @Autowired
    private ReceiveMessageMapper receiveMessageMapper;

    @Override
    public int insert(ReceiveMessage receiveMessage){
        return receiveMessageMapper.insert(receiveMessage);
    }

    @Override
    public ReceiveMessage getByReceiveMessageCode(String receiveMessageCode) {
        return receiveMessageMapper.getByReceiveMessageCode(receiveMessageCode);
    }

    @Override
    public PageInfo<ReceiveMessage> getPageListBySendMessageCode(int pageIndex, int pageSize, String sendMessageCode,String governmentCode) {
        PageHelper.startPage(pageIndex, pageSize);
        List<ReceiveMessage> receiveMessages = receiveMessageMapper.getPageListBySendMessageCode(sendMessageCode,governmentCode);
        PageInfo<ReceiveMessage> pageInfo = new PageInfo<>(receiveMessages);
        return pageInfo;
    }



}
